let Promise = require('./promise')

let p = new Promise((resolve, reject) => {
    resolve(1)
})

let promise2 = p.then(data => {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            // reject('错误')
            resolve('错误')
        }, 1000);
    })
})

promise2.then(data => {
    console.log('--', data)
}, err => {
    console.log('fail', err) // TypeError
})

// let promise2 = p.then(data => {

// }).then(data => {

// })
// // -----------
// let promise2 = p.then(data => {

// })
// promise2.then(data => {

// })